#include <iostream>
using namespace std;

int main() {

    int q;
    cin >> q;

    int a, b, c, res;
    while (q--)
    {
        cin >> a >> b >> c;

        res = min(a, b);
        res = min(res, c);

        int sum = 0;
        sum = res * 2;

        if (b - res >= 2)
        {
            sum += (b - res) - 1;
        }

        cout << sum << endl;

    }
    return 0;
}